import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Put } from '@nestjs/common';
import { GoodService } from './good.service';
import { CreateGoodDto } from './dto/create-good.dto';
import { UpdateGoodDto } from './dto/update-good.dto';
import { FindGoodDto } from './dto/find-good.dto';
import { DeleteIds } from '../dto/all-dto';

@Controller('good')
export class GoodController {
  constructor(private readonly goodService: GoodService) {}

  @Post()
  create(@Body() createGoodDto: CreateGoodDto) {
    return this.goodService.create(createGoodDto);
  }

  @Get()
  findAll(@Query() findGoodDto : FindGoodDto) {
    return this.goodService.findAll(findGoodDto);
  }

  @Get(':id')
  findOne(@Param('id') id: number) {
    return this.goodService.findOne(id);
  }

  @Put()
  update(@Body() updateGoodDto: UpdateGoodDto) {
    return this.goodService.update(updateGoodDto);
  }

  @Delete()
  remove(@Body() ids: DeleteIds) {
    return this.goodService.remove(ids);
  }
}
